<template>
  <div class="recommend">
      <div class="title">热门推销</div>
    <ul>
      <li class="item" v-for="item in recommendList" :key="item.id">
        <img class="item-img" :src="item.imgUrl" alt="">
        <div class="item-info">
          <p class="item-title">{{item.title}}</p>
          <p class="item-desc">{{item.desc}}</p>
          <button class="item-button" @click="goDetail(item.id)">查看详情</button>
        </div>
      </li>
    </ul>
  </div>
</template>

<script>
export default {
  name: 'recommend',
  props: {
    recommendList: {
      type: Array,
      default: () => {
        return []
      }
    }
  },
  methods: {
    goDetail (id) {
      this.$router.push('/detail/' + id)
    }
  }
}
</script>

<style lang="stylus" scoped>
@import '~@/assets/styles/mixins.styl'
  .title
   margin-top .2rem
   background-color #eee
   text-indent .2rem
   line-height  .8rem
   font-weight 700
  .item
   border-bottom: 1px solid #ccc;
   overflow hidden
   display flex
   height 1.9rem
   .item-img
    width 1.7rem
    height 1.7rem
    padding .1rem
   .item-info
    padding .2rem
    min-width 0
    flex 1
    .item-title
     ellipsis()
     line-height 0.54rem
     font-size .32rem
    .item-desc
     ellipsis()
     line-height .4rem
     color #ccc
    .item-button
     color #fff
     line-height .44rem
     margin-top .16rem
     padding 0 .2rem
     background-color #ff9300
     border-radius .06rem
</style>
